package leetcode_core.leetcode_2;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class SubsetsWithDup {

    private List<List<Integer>>  ans = new ArrayList<>();
    private LinkedList<Integer> track = new LinkedList<>();

    public List<List<Integer>> subsetsWithDup(int[] nums) {
        Arrays.sort(nums);
        backtrack(0,nums);
        return null;
    }

    private void backtrack(int start,int[] nums){
        ans.add(new LinkedList<>(track));
        for(int i = start;i<nums.length;i++){
            //做选择之前先做判断
            if(i>start && nums[i] == nums[i-1]){
                continue;
            }
            //做选择
            track.add(nums[i]);
            //回溯递归
            backtrack(i+1,nums);
            //撤销选择
            track.removeLast();
        }
    }




}
